﻿<Page
    x:Class="WinStorAppDemoApplication.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:mark="using:WinRtMvvmBindingPack"
    mc:Ignorable="d" >

    <!--<Page.DataContext>
        <StaticResource ResourceKey="MainWindowVm"/>
    </Page.DataContext>-->

    <mark:BindXAML.AssignProperties>
        <mark:IocBinding ServiceType="MainWindowVm" ServiceKey="MainWindowVm" TargetPropertyName="DataContext"/>
    </mark:BindXAML.AssignProperties>


    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        <TextBox HorizontalAlignment="Left" Margin="373,43,0,0" TextWrapping="Wrap" Text="{Binding ButtonClickMsg, Mode=TwoWay, Source={StaticResource MainWindowVm}}" VerticalAlignment="Top" Width="651"/>

        <Button Width="280" Content="Button Click-Resource-Method  " HorizontalAlignment="Left" Margin="40,20,0,0" VerticalAlignment="Top">
            <mark:BindXAML.AddEvents>
                <mark:BindEventHandlerResource ResourceKey=" MainWindowVm" MethodName="ButtonClickMethod" TargetEventName="Click"/>
            </mark:BindXAML.AddEvents>
        </Button>

        <Button Width="280" Content="Button Click-Resource-Property" HorizontalAlignment="Left" Margin="40,60,0,0" VerticalAlignment="Top">
            <mark:BindXAML.AddEvents>
                <mark:BindEventHandlerResource ResourceKey=" MainWindowVm" PropertyName="ButtonClickPropDelegate" TargetEventName="Click"/>
            </mark:BindXAML.AddEvents>
        </Button>

        <Button Width="280" Content="Button Click-PageDataContext-Method  " HorizontalAlignment="Left" Margin="40,100,0,0" VerticalAlignment="Top">
            <mark:BindXAML.AddEvents>
                <mark:BindEventHandler MethodName="ButtonClickMethod" TargetEventName="Click"/>
            </mark:BindXAML.AddEvents>
        </Button>

        <Button Width="280" Content="Button Click-PageDataContext-Property" HorizontalAlignment="Left" Margin="40,140,0,0" VerticalAlignment="Top">
            <mark:BindXAML.AddEvents>
                <mark:BindEventHandler PropertyName="ButtonClickPropDelegate" TargetEventName="Click"/>
            </mark:BindXAML.AddEvents>
        </Button>

        <Button Width="280" Content="Button Click-Std-Binding-DataContext" HorizontalAlignment="Left" Margin="40,180,0,0" VerticalAlignment="Top"
        Command="{Binding CommandProxy}"  >
            <mark:BindXAML.AssignProperties>
                <mark:LocateDataContext  PropertyName="ButtonClickPropDelegate" TargetPropertyName="Tag"/>
            </mark:BindXAML.AssignProperties>
        </Button>
        
        <Button Width="280" Content="Button Click-IOC-Method  " HorizontalAlignment="Left" Margin="380,100,0,0" VerticalAlignment="Top">
            <mark:BindXAML.AddEvents>
                <mark:BindEventHandlerIoc ServiceType="MainWindowVm" ServiceKey="MainWindowVm" MethodName="ButtonClickMethod" TargetEventName="Click"/>
            </mark:BindXAML.AddEvents>
        </Button>

        <Button Width="280" Content="Button Click-IOC-Property" HorizontalAlignment="Left" Margin="380,140,0,0" VerticalAlignment="Top">
            <mark:BindXAML.AddEvents>
                <mark:BindEventHandlerIoc ServiceType="MainWindowVm" ServiceKey="MainWindowVm" PropertyName="ButtonClickPropDelegate" TargetEventName="Click"/>
            </mark:BindXAML.AddEvents>
        </Button>

        <!--Command="{CustomResource '[BindCommandResource  ResourceKey=MainWindowVm,ExecuteMethodName=ExecuteMethod,CanExecuteMethodName=CanExecuteMethod,EventToInvokeCanExecuteChanged=EventHandlerNotifyCanExecuteChanged]'}"
        Command="{CustomResource '[BindCommandIoc  ServiceType=MainWindowVm,ServiceKey=MainWindowVm,ExecuteMethodName=ExecuteMethod,CanExecuteMethodName=CanExecuteMethod,EventToInvokeCanExecuteChanged=EventHandlerNotifyCanExecuteChanged]'}"-->

        <Button Width="280" Content="Button Custom-App-Resource-Method  " HorizontalAlignment="Left" Margin="380,200,0,0" VerticalAlignment="Top">
            <mark:BindXAML.BindToCommand>
                <mark:BindCommandResource  ResourceKey="MainWindowVm" ExecuteMethodName="ExecuteMethod" CanExecuteMethodName="CanExecuteMethod" EventToInvokeCanExecuteChanged="EventHandlerNotifyCanExecuteChanged"/>
            </mark:BindXAML.BindToCommand>
        </Button>


        <Button Width="280" Content="Button Custom-App-Ioc-Method  " HorizontalAlignment="Left" Margin="380,250,0,0" VerticalAlignment="Top">
            <mark:BindXAML.BindToCommand>
                <mark:BindCommandIoc  ServiceType="MainWindowVm" ServiceKey="MainWindowVm" ExecuteMethodName="ExecuteMethod" CanExecuteMethodName="CanExecuteMethod" EventToInvokeCanExecuteChanged="EventHandlerNotifyCanExecuteChanged"/>
            </mark:BindXAML.BindToCommand>

        </Button>

        <Button Width="280" Content="Button Custom-App-DataContext-Method  " HorizontalAlignment="Left" Margin="380,300,0,0" VerticalAlignment="Top">
            <mark:BindXAML.BindToCommand>
                <mark:BindCommand  ExecuteMethodName="ExecuteMethod" CanExecuteMethodName="CanExecuteMethod" EventToInvokeCanExecuteChanged="EventHandlerNotifyCanExecuteChanged"/>
            </mark:BindXAML.BindToCommand>
        </Button>

    </Grid>
</Page>
